<template>
  <div class="box">
    <h2>Son2 子组件</h2>
    从Vuex中获取的count值为：<label>{{ $store.state.count }}</label>
    <br>
    <button @click="add">+ 5</button>
    <p>{{ upperCaseName }}</p>
  </div>
</template>
<script>
import { mapGetters, mapState } from 'vuex'

export default {
  name: 'SonTwo',
  data () {
    return {}
  },
  computed: {
    ...mapState(['count']),
    ...mapGetters('user', ['upperCaseName'])

  },
  methods: {
    add () {
      this.$store.commit('addCount', 5)
    }
  }
}
</script>
<style>
.box {
  border: 1px solid red;
  width: 400px;
  padding: 10px;
  margin: 10px;
}

h2 {
  margin-top: 10px;
}
</style>
